<template>
	<div class="pages">
		<div style="display: flex;align-items: center;">
			<div>创制券审核方式：</div>
			<el-radio-group v-model="radio">
				<el-radio :label="1">自动审核</el-radio>
				<el-radio :label="0">手动审核</el-radio>
			</el-radio-group>
			<el-button type="primary" size="small" style="margin-left: 30px;" @click="submit">保存</el-button>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				radio: 1
			}
		},
		methods: {
			getInfo() {
				this.$loading()
				this.$http.post('/api/settings/auto_action', {}).then(res => {
					this.$closeLoading()
					this.radio = res.result.auto_action
				})
			},
			submit() {
				this.$http.post('/api/settings/auto_action', {
					auto_action: this.radio,
					is_post: 1,
				}).then(res => {
					this.$closeLoading()
					this.$message({
						message: res.msg,
						type: 'success',
						duration: 1000,
						onClose: () => {
							this.getInfo()
						}
					});
				})
			}
		},
		created() {
			this.getInfo()
		}
	}
</script>

<style lang="scss" scoped>
</style>